package com.riki.riki_push_example.protecter.plugin;

import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.EventChannel;

public class AndroidInfoUploader implements EventChannel.StreamHandler {
    
    private static AndroidInfoUploader singleton;
    
    public static AndroidInfoUploader getInstance(){
        if(singleton == null) {
            synchronized (AndroidInfoUploader.class) {
                if(singleton == null) {
                    singleton = new AndroidInfoUploader();
                }
            }
        }
        return singleton;
    }

    public static String CHANNEL = "com.dabanjia.uploader";

    static EventChannel channel;
    

    public static void registerWith(BinaryMessenger binaryMessenger) {
        channel = new EventChannel(binaryMessenger, CHANNEL);
        AndroidInfoUploader.getInstance();
        channel.setStreamHandler(AndroidInfoUploader.getInstance());
    }

    public EventChannel.EventSink sinker;

    @Override
    public void onListen(Object arguments, EventChannel.EventSink events) {
        sinker = events;

    }

    @Override
    public void onCancel(Object arguments) {

    }
}
